package com.gxa.saas.service.impl;

import com.gxa.saas.mapper.StoreHouseOutMapper;
import com.gxa.saas.pojo.GoodsXq;
import com.gxa.saas.pojo.Storage;
import com.gxa.saas.pojo.StoreHouseOut;
import com.gxa.saas.service.StoreHouseOutService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class StoreHouseOutServiceImpl implements StoreHouseOutService {
    @Autowired
    StoreHouseOutMapper storeHouseOutMapper;


    @Override
    public List<StoreHouseOut> selectByPage(Integer limit, Integer size) {
        List<StoreHouseOut> storeHouseOuts=storeHouseOutMapper.selectByPage((limit-1)*size,size);
        return storeHouseOuts;
    }

    @Override
    public Integer addOutList(StoreHouseOut storeHouseOut) {
        return storeHouseOutMapper.addOutList(storeHouseOut);
    }

    @Override
    public Integer deleteById(Integer id) {

        return storeHouseOutMapper.deleteById(id);
    }

    @Override
    public StoreHouseOut selectById(Integer id) {
        return storeHouseOutMapper.selectById(id);
    }

    @Override
    public Storage selectByDetailId(Integer id) {
        return storeHouseOutMapper.selectByDetailId(id);
    }

    @Override
    public Integer insertGoodsXq(GoodsXq goodsXq) {
        return storeHouseOutMapper.insertGoodsXq(goodsXq);
    }

    @Override
    public GoodsXq selectByGoodsXqId(Integer id) {
        return storeHouseOutMapper.selectByGoodsXqId(id);
    }

    @Override
    public Integer update(Map map) {
        return storeHouseOutMapper.update(map);
    }

    @Override
    public Integer updateCheck(Integer id, String comments) {
        return storeHouseOutMapper.updateCheck(id,comments);
    }

    @Override
    public List<GoodsXq> selectDetailById(Integer id) {
        List<GoodsXq> goodsXqs = storeHouseOutMapper.selectDetailById(id);
        return goodsXqs;
    }

    @Override
    public List<StoreHouseOut> selectAll() {
        List<StoreHouseOut> storeHouseOuts = storeHouseOutMapper.selectAll();
        return storeHouseOuts;
    }



    @Override
    public List<StoreHouseOut> selectByDateAndDepotAndState(Map map) {
        return storeHouseOutMapper.selectByDateAndDepotAndState(map);
    }

    @Override
    public Integer updateByOut(StoreHouseOut storeHouseOut) {
        return storeHouseOutMapper.updateByOut(storeHouseOut);
    }

    @Override
    public List<Storage> getStorageList(Integer limit, Integer size) {
        return storeHouseOutMapper.selectStorageByPage((limit-1)*size, size);
    }


    @Override
    public Integer getTotalCountOut() {
        return storeHouseOutMapper.selectTotalMount();
    }

    @Override
    public Integer getTotalStorageOut() {
        return storeHouseOutMapper.selectTotalStorage();
    }

    @Override
    public Integer getTotalByLike(String name) {
        return storeHouseOutMapper.selectTotalByLike(name);
    }

    @Override
    public Integer getTotalByTiaojian(Map map) {
        return storeHouseOutMapper.selectTotalByTiaojian(map);
    }

    @Override
    public List<StoreHouseOut> getDropDownList() {
        return storeHouseOutMapper.getDropDownList();
    }

    @Override
    public List<Storage> selectStoreDetail(String goodsName, Integer page, Integer size) {
        return storeHouseOutMapper.selectStoreDetail(goodsName, (page-1)*size, size);
    }

    @Override
    public Integer deleteDetailById(Integer id) {
        return storeHouseOutMapper.deleteDetailById(id);
    }

    @Override
    public Integer updateByPrice(Integer bigCount, Integer smallCount, Double money, Integer id) {
        return storeHouseOutMapper.updateByPrice(bigCount, smallCount, money, id);
    }
}
